<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::group(['middleware' => 'checkStatus'],function(){
    Route::get('/', function (\Modules\Admin\Service\ModuleService $moduleService) {
        //访问后台设置的默认模块
        $module = $moduleService->getDefault();
        //dd($module);
        $class = '\\Modules\\'.$module['name'].'\\Http\\Controllers\\HomeController';
        //dd($class);
        //访问后台设置的默认模块
        return app()->build($class)->index();
        //app()->build($class)相当于(new $class)
    });
});
//展示账号尚未激活方法路由
Route::get('/show','UserController@show')->name('show');
//激活账号路由
Route::get('/jihuo/{token}','UserController@jihuo')->name('jihuo');
//重新发送激活邮件路由
Route::get('/sendEmail','UserController@sendMail')->name('sendEmail');

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
//上传图片路由
//这里使用any路由，因为不确定上传图片的方式具体是GET还是POST
Route::any('/upload','UploadController@upload');
//编辑器上传图片处理路由
Route::any('/upload-simditor','UploadController@bianji');
//获取已经上传的图片路由
Route::any('/fileLists','UploadController@fileLists');

//绑定微信的路由
Route::any('/wechat','WechatController@handle');

